<div class='_line'></div>
<div  style='float:left'>
    <a href="/user/order?store_id=<?php echo $_GET['store_id']?>" style='font-size:2rem' >订单 </a>&nbsp;&nbsp;&nbsp;&nbsp;
    <a href="/user/coupon/index?store_id=<?php echo $_GET['store_id']?>&client_id=<?php echo $_SESSION['client_id']?> " style='font-size:2rem' >优惠劵 </a>
</div>
<div class='_line'></div>
<div class='_line'></div>
<div class='_cut'></div>
<div id='content'>
    <?php foreach($orders as $k=>$v){ ?>
    <?php if($k%3==0){?>
<div class='row'>
    <?php }?>
    <div class='col-sm-3 col-md-4'>
        <div class="thumbnail" style="margin-bottom:10px">
            <?php if($v['team_number']){ ?>
            <a href="<?php echo '/user/action/info?store_id='.$v['store_id'].'&aid='.$v['action_id'].'&barber_id='.$v['barber_id'].'&team_number='.$v['team_number'];?>">
                <?php } ?>
                <div class='caption'>
                <div>
                <div><?php if($v['team_number']){ ?>
                    <b><span style="font-size:2rem;color:#6495ED">活动：<?php echo $v['action_name'];?></span></b>
                    <?php }else{?>
                    <b><span style="font-size:2rem;color:#6495ED">商城：<?php echo $v['action_name'];?></span></b>
                    <?php  }?>
                </div>
                <div>
                    <span>订单号：<?php echo $v['order_number'];?></span>
                </div>
                <div>
                    <span>金额：<?php echo $v['price']/100;?>元</span>
                </div>
                <div>
                    <span>下单时间：<?php echo date('Y-m-d H:i:s',$v['create_time']);?></span>
                </div>
                <div>
                    <span>项目：<?php echo $v['type'];?></span>
                </div>
                <div>
                    <span>门店：<?php echo $stores[$v['store_id']];?></span>
                </div>
                <div>
                    <span>订单状态：<?php if($v['status']==1){echo '未使用';}elseif($v['status']==2){echo '已使用';}elseif($v['status']==0){ echo '未支付'; };?></span>
                </div>
                <div>
                    <span>类型：<?php if($v['team_number']){ echo $v['my'];}else{ echo '商城订单'; }?></span>&nbsp;&nbsp;
                    <?php if($v['team_number']){ ?>
                    <span style="color:#CD5C5C">人数：<?php echo $v['people_num'];?></span>&nbsp;&nbsp;
                    <span style="color:#CD5C5C">状态：<?php echo $v['_status'];?></span>
                    <?php } ?>
                </div>
                </div>
            </div><?php if($v['team_number']){ ?> </a> <?php } ?>
            <div style='text-align: right;'>
                <a href="/user/order/info?id=<?php echo $v['id'];?>&store_id=<?php echo $v['store_id'];?>">订单详情</a>&nbsp;&nbsp;&nbsp;&nbsp;
                <?php if($v['team_number']){ ?>
                <a href="<?php echo '/user/action/info?store_id='.$v['store_id'].'&aid='.$v['action_id'].'&barber_id='.$v['barber_id'].'&team_number='.$v['team_number'];?>">分享增加成团几率</a>
                <?php }else{ ?>
                <a href="javascript:;" id='pay' >去支付</a>
                <?php  } ?>
            </div>
        </div>
        
        <div class='_line'></div>
    </div>
    <?php if(($k+1)%3==0 || $orders[$k+1]['id']<1){?>
</div>
    <?php } ?>
    <?php } ?>
</div>
<div id='showCode' style="text-align:center;width:100%;height:100%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#8E8E8E',endColorstr='##8E8E8E');
    background-color:rgba(0, 0,0, 0.5);position:fixed; _position:absolute; top:0;left:0; z-index:5000;display:none "> 
    <div class="settle_div">
        <img width='25px'; id='down' style='float:right;margin-top:-1rem;margin-right:-1rem' src='/public/images/error1.png' >
        <div style='padding:4rem;'>
    <form action='/user/order/mobile?store_id=<?php echo $v['store_id'];?>' method="post" id='login_form'>

        <div class='form-group' id='appends'>
            <input type='hidden' name='store_id' value='<?php echo $v['store_id']; ?>' >
            <input type='hidden' name='rmb' id='rmb' value='0' > 
            <input type="text" class="form-control" id='mobile' name='mobile' placeholder="请输入手机号" value=""/>
        </div>
        <div class='form-group' style="text-align: right">
            <input type="text" class="form-control" name="code" placeholder="验证码" value=""/><br/>
            <button type="button" id='subcode' onclick="_code();" style='width:10rem'>获取验证码</button>
        </div>
        <div class="form-group login_sub">
            <input type="submit" class="btn btn-info" name="submit" value="提交">
        </div>
    </form>
    </div>
</div>

</div>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type='text/javascript'>
$(document).ready(function(){
    $('#pay').click(function(){
        $('#showCode').show();
    });
    $('#down').click(function(){
        $('#showCode').hide();
    });
    
})
    var number = 12;
    function loaddata()
    {
        if(number ==-1){
            return;
        }
        totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());

        if ($(document).height() <= totalheight)
        {
            $.ajax({ url: "/user/order/append?store_id=<?php echo (int)$_GET['store_id'];?>&start="+number,async:true, success: function(msg){
                    if(msg == 'false'){
                        number = -1;
                        return ;
                    }
                    var html = "";
                    msg = eval('(' + msg + ')');
                    $.each(msg,function(i,v){
                        if(i%4==0){
                            html += "<div class='row'>";
                        }
                        html += "<div class='col-sm-3 col-md-4'>";
                        html += '<div class="thumbnail" style="margin-bottom:10px">';
                        html += "<a href='/user/action/info?store_id="+v.store_id+'&aid='+v.action_id+'&barber_id='+v.barber_id+'&team_number='+v.team_number+"'><div class='caption'>";
                        html += '<div><div><b><span style="font-size:2rem;color:#6495ED">';
                        html += '活动：';
                        html += v.action_name==null?'':v.action_name;
                        html += '</span></b>';
                        html += '</div><div><span>订单号：';
                        html += v.order_number==null?'':v.order_number;
                        html += '</span></div><div><span>金额：';
                        html += v.price==null?'':v.price;
                        html += '</span></div><div><span>下单时间：';
                        html += v.create_time==null?'':v.create_time;
                        html += '</span></div><div><span>项目：';
                        html += v.type==null?'':v.type;
                        html += '</span></div><div><span>门店：';
                        html += v.type==null?'':v.store_name;
                        html += '</span></div><div><span>订单状态：';
                        html += v.status==1?'已支付':'已完成';
                        html += '</span></div><div><span>类型：';
                        html += v.my;
                        html += '</span>&nbsp;&nbsp;<span style="color:#CD5C5C">人数：';
                        html += v.people_num;
                        html += '</span>&nbsp;&nbsp;<span style="color:#CD5C5C">状态：';
                        html += v._status;
                        html += '</span></div></div></div></a>';
                        html += "<div style='text-align: right;'>";
                        html += '<a href="/user/order/info?id='+v.id+'&store_id='+v.store_id+'">订单详情</a>&nbsp;&nbsp;&nbsp;&nbsp;';        
                        html +="<a href='/user/action/info?store_id=";
                        html += v.store_id+'&aid=';
                        html += v.id;
                        html += '&barber_id='+v.barber_id+'&team_number='+v.team_number+"'>分享增加成团几率</a></div></div><div class='_line'></div></div>";
                        if((i+1)%3==0){
                            html += "</div>";
                        }
                        number += 1;
                    });
                    $('#content').append(html);
            }});
        }
    }

    $(window).scroll(function () {
        loaddata();
    });
    <?php if($weixin == true){?>
    wx.config({
        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
        appId: '<?php echo WEIXIN_PAY_APP_ID;?>', // 必填，公众号的唯一标识
        timestamp: <?php echo $data["timestamp"];?>, // 必填，生成签名的时间戳
        nonceStr: '<?php echo $data["noncestr"];?>', // 必填，生成签名的随机串
        signature: '<?php echo $data["sign"];?>',// 必填，签名，见附录1
        jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
    });
    wx.ready(function () {
        wx.onMenuShareTimeline({
            title: '<?php echo $action['action_name'] ;?>', // 分享标题
            link: '<?php echo $data["url"];?>', // 分享链接
            imgUrl: '<?php echo "http://".MAIN_DOMAIN.$logo;?>', // 分享图标
            success: function () { 


            },
            cancel: function () { 
                // 用户取消分享后执行的回调函数

            },
            trigger: function(){
                alert("请点击您要分享的订单,进入活动页再分享。");
                WeixinJsBridge.invoke('disabledShare',{},function(e){
                    //禁止用户分享错误的页面
                })
            }
        });
        wx.onMenuShareAppMessage({
            title: '<?php echo $action['action_name'] ;?>', // 分享标题
            desc: "<?php echo strip_tags($action['intro']);?>", // 分享描述
            link: '<?php echo $data["url"];?>', // 分享链接
            imgUrl: '<?php echo "http://".MAIN_DOMAIN.$logo;?>', // 分享图标
            type: '', // 分享类型,music、video或link，不填默认为link
            dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
            success: function () { 
                // 用户确认分享后执行的回调函数

            },
            cancel: function () { 
                // 用户取消分享后执行的回调函数

            },
            trigger: function(){
                alert("请点击您要分享的订单,进入活动页再分享。");
                WeixinJsBridge.invoke('disabledShare',{},function(e){
                    //禁止用户分享错误的页面
                })
            }
        });
    })
<?php }?>

</script>

